Skip to content

ref(analytics): Transform analytics events for TET-834 #95214

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

constantinius
Copy link
Contributor

  • Transform event classes to use @analytics.eventclass decorator
  • Transform analytics.record calls to use event class instances
  • Update imports as needed

Closes TET-834

- Transform event classes to use @analytics.eventclass decorator
- Transform analytics.record calls to use event class instances
- Update imports as needed

Closes TET-834
@constantinius constantinius requested review from a team as code owners July 10, 2025 09:16
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Jul 10, 2025
cursor[bot]

This comment was marked as outdated.

Copy link

codecov bot commented Jul 11, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #95214      +/-   ##
==========================================
- Coverage   85.40%   80.33%   -5.08%     
==========================================
  Files       10478    10468      -10     
  Lines      605935   605079     -856     
  Branches    23673    23642      -31     
==========================================
- Hits       517488   486067   -31421     
- Misses      88083   118652   +30569     
+ Partials      364      360       -4     

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Type Mismatch in Analytics Event Classes

Analytics event classes declare ID fields (user_id, organization_id, sentry_app_id, sentry_app_installation_id) as str types. However, the calling code consistently passes integer values (e.g., user.id, organization.id, sentry_app_installation.id). This type mismatch, introduced by the recent refactor to decorator-based analytics with type annotations, could lead to runtime type validation errors.

src/sentry/analytics/events/sentry_app_installation_token_created.py#L5-L9

class SentryAppInstallationTokenCreated(analytics.Event):
user_id: str
organization_id: str
sentry_app_installation_id: str
sentry_app: str

src/sentry/analytics/events/sentry_app_created.py#L5-L8

class SentryAppCreatedEvent(analytics.Event):
user_id: str
organization_id: str
sentry_app: str

src/sentry/analytics/events/sentry_app_deleted.py#L5-L8

class SentryAppDeletedEvent(analytics.Event):
user_id: str
organization_id: str
sentry_app: str

src/sentry/analytics/events/sentry_app_installed.py#L5-L8

class SentryAppInstalledEvent(analytics.Event):
user_id: str
organization_id: str
sentry_app: str

src/sentry/analytics/events/sentry_app_installation_updated.py#L5-L8

class SentryAppInstallationUpdatedEvent(analytics.Event):
sentry_app_installation_id: str
sentry_app_id: str
organization_id: str

src/sentry/analytics/events/alert_rule_ui_component_webhook_sent.py#L6-L8

# organization_id refers to the organization that installed the sentryapp
organization_id: str
sentry_app_id: str

src/sentry/analytics/events/sentry_app_token_exchanged.py#L5-L6

class SentryAppTokenExchangedEvent(analytics.Event):
sentry_app_installation_id: str

src/sentry/analytics/events/internal_integration_created.py#L5-L7

class InternalIntegrationCreatedEvent(analytics.Event):
user_id: str
organization_id: str

src/sentry/analytics/events/sentry_app_uninstalled.py#L5-L7

class SentryAppUninstalledEvent(analytics.Event):
user_id: str
organization_id: str

src/sentry/analytics/events/sentry_app_updated.py#L5-L7

class SentryAppUpdatedEvent(analytics.Event):
user_id: str
organization_id: str

src/sentry/analytics/events/sentry_app_schema_validation_error.py#L6-L10

schema: str
user_id: str
sentry_app_id: str | None = None
sentry_app_name: str
organization_id: str

src/sentry/analytics/events/sentry_app_installation_token_deleted.py#L5-L8

class SentryAppInstallationTokenDeleted(analytics.Event):
user_id: str
organization_id: str
sentry_app_installation_id: str

Fix in CursorFix in Web


Was this report helpful? Give feedback by reacting with 👍 or 👎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Backend Automatically applied to PRs that change backend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant